var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
// var a = 123;
// console.log(a);
// function fn() {
//   console.log(666)
// }
// let b = true;
// let c = 'qqq';
// a = true;
var a = 1233.3242;
// a = ''
var b = '';
var c = true;
// 以上三个是基本数据类型
// 联合类型
var d = 123;
d = 333;
d = 'qqq';
// let arr = [1, 2, true];
// 创造一个数组 数组中的每一项都得是数字
var arr = [1, 2, true];
// let arr: Array<number> = [1, 2, 3, '']
// let arr: Array<number|string> = [1, 2, 3, '']
// 元组
// 规定了数量和类型的数组
var arr2 = [1, 2];
var arr3 = [1, '', true];
arr3[0] = 100;
// 枚举  其实就是一个对象  code code == 0 ?'man'
var Person;
(function (Person) {
    Person[Person["man"] = 0] = "man";
    Person[Person["women"] = 1] = "women";
    Person[Person["girl"] = 2] = "girl";
    Person[Person["boy"] = 3] = "boy";
})(Person || (Person = {}));
console.log(Person);
for (var k in Person) {
    console.log(k);
}
var qqq;
(function (qqq) {
    qqq[qqq["play"] = 100] = "play";
    qqq[qqq["eat"] = 200] = "eat";
    qqq[qqq["sleep"] = 300] = "sleep";
})(qqq || (qqq = {}));
// 任意数据类型 跟写JS就一样了
var aa = 123;
aa = true;
// null undefined
var arr4 = [];
var a2 = 123;
a2 = undefined;
a2 = null;
// let a3: null = null;
// a3=1
// void 没有任何类型
// 当前的函数没有任何返回
function aaa() {
    // return undefined
    // return null
}
function bbb() {
    return 234;
}
function f(a, b) {
    return a + b;
}
f(1, 3);
f(1, 2);
function f2(a, b) {
    return a + b;
}
f2(1, '3');
// b 可以不传
// 可选参数只能放到最后
function f3(a, b, c) {
    return a + b;
}
f3(1);
// 默认值
// 默认值和可选符号不能同时存在
function f4(a, b) {
    b = b || 10;
    console.log(a + b);
}
f4(1, 2);
f4(1);
function f5(a, b) {
    if (b === void 0) { b = 10; }
    console.log(a + b);
}
f5(1);
// 剩余运算符
function f6(a) {
    var b = [];
    for (var _i = 1; _i < arguments.length; _i++) {
        b[_i - 1] = arguments[_i];
    }
    console.log(a, b);
}
f6(1, 2, 3, 4, 5, 6, 7, 8, 9);
// 重载
// let obj = {
//   name:'',
//   age:0
// }
var obj = {};
function f7(a) {
    if (typeof a == 'number') {
        obj.age = a;
    }
    else {
        obj.name = a;
    }
}
f7(1, 2);
f7('zhufeng');
// f7(true)
var School = /** @class */ (function () {
    function School() {
        this.name = "珠峰";
    }
    School.prototype.getName = function () {
        return this.name;
    };
    School.age = 100; // 类的静态属性的赋值于类型声明
    return School;
}());
var s1 = new School();
// console.log(s1.name)
var School2 = /** @class */ (function (_super) {
    __extends(School2, _super);
    function School2() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    School2.prototype.getName2 = function () {
        // console.log(this.name)
        console.log(this.name2);
    };
    School2.prototype.changeAge = function (n) {
        // this.age2 = n
    };
    return School2;
}(School));
var s2 = new School2();
s2.getName2();
var obj5 = {
    name: "zhufeng",
    age: 12,
    sex: 1
};
var obj6 = {
    name: "zhufeng",
    age: 12
};
var obj7 = {
    name: 'zhufeng',
    age: 12,
    talk: function (a, b) {
        return a + b;
    },
    q: 1,
    b: 2
};
obj7.talk('qq', 'ww');
// 类去实现接口 让当前的类 遵循接口
var Animal = /** @class */ (function () {
    function Animal() {
    }
    Animal.prototype.eat = function () {
        console.log(666);
    };
    Animal.prototype.play = function (name) {
        return name;
    };
    Animal.prototype.qq = function () {
    };
    return Animal;
}());
var ani = new Animal();
var s = {
    age: 123,
    play: function () {
        console.log('play');
    },
    learn: function (type) {
        return 'hao';
    }
};
console.log(s.age);
var f1 = function (a, b, c) {
    console.log(c);
    return a + b;
};
f1(1, 2, '');
// 泛型
/* function createAry(length: number, value: string | number): Array<string | number> {
  let ary: (string | number)[] = [];
  for (let i = 0; i < length; i++) {
    ary[i] = value + ''
  }
  return ary
}
console.log(createAry(3, '2'))
console.log(createAry(3, 2)) */
function createAry(length, value) {
    var ary = [];
    for (var i = 0; i < length; i++) {
        ary[i] = value;
    }
    return ary;
}
console.log(createAry(3, '2'));
console.log(createAry(3, 2));
console.log(createAry(3, { name: 'q', age: 1 }));
var MyAry = /** @class */ (function () {
    function MyAry() {
        this.list = [];
    }
    MyAry.prototype.add = function (value) {
        this.list.push(value);
    };
    return MyAry;
}());
var ary2 = new MyAry();
ary2.add(12);
var list123 = {
    list: [1, 2]
};
var list124 = {
    list: ['']
};
var list125 = {
    list: [{ name: '', age: 1 }]
};
